<template>
    <!-- 质量检查情况 -->
    <a-spin :spinning="loading">
      <a-card>
        <title-name :title="`${$route.query.month}月质量管理信息概览`"></title-name>
        <!-- 详情列表 -->
        <div style="padding: 0 20px 20px;">
          <title-name title="质量检查与整改统计"></title-name>
          <Empty v-if="dataSource.length == 0" description="暂无数据" />
          <a-table v-else :rowKey="(record, index) => record.id" bordered :pagination="false" :columns="columns" :dataSource="dataSource">
          </a-table>
        </div>
      </a-card>
    </a-spin>
  </template>
  
  <script>
  import { getCheckSelf } from '@/api/quality/qualityMonth' // api
  import { Empty } from 'ant-design-vue' // 无数据提示
  import { columns5 } from './qualityManagementInfoColumns'
  export default {
    name: 'a' + Date.now(),
    props: {
      // 请求参数
      queryParam: {
        type: Object,
        default: () => null
      }
    },
    components: {
      Empty,
    },
    data() {
      return {
        loading: false, // 加载控件
        dataSource: [] // 详情
      }
    },
    computed: {
      // 统计表头
      columns() {
        let columns = columns5
        return columns
      }
    },
    mounted() {
      // 初始化
      this.init()
    },
    methods: {
      /**
       * 初始化
       */
      init() {
        this.loading = true
        // 请求检查情况
        getCheckSelf({isJurisdiction: false, ...this.queryParam})
          .then((res) => {
            if (res.data) {
              this.dataSource = res.data.counts || []
            }
          })
          .finally(() => {
            this.loading = false
          })
      },
    }
  }
  </script>
  